package com.spinneractivity.qingyuan;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Spinner;

public class MainActivity extends AppCompatActivity {
    Spinner spinner;
    AutoCompleteTextView actv;
    String[] names={"老李","老张","小明","小梁3","大哥啊","大牛","喜爱"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        spinner= (Spinner) findViewById(R.id.spinner);
        ArrayAdapter<String> adapter=new ArrayAdapter<>(this,R.layout.support_simple_spinner_dropdown_item);
        adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        adapter.add("JAVA");
        adapter.add("C++");
        adapter.add("Android");
        spinner.setAdapter(adapter);
        initView();

    }

    private void initView() {
        actv= (AutoCompleteTextView) findViewById(R.id.actv);
        ArrayAdapter<String> adapter01=new ArrayAdapter<String>(this,R.layout.support_simple_spinner_dropdown_item,names);
        actv.setAdapter(adapter01);
    }
}
